home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
cad
/
acadlsp.zip
/
ARGH.LSP
< prev
next >
Wrap
Text File
|
1987-06-24
|
6KB
|
82 lines
; (c) 1986,1987 New Riders Publishing
;*Set your TAB spacing to 2, and print this file with a 132 col width
(prompt "\nThis is ACAD.LSP for WORKOUT... ") ;* displays the prompt as file loads
(vmon) ;* turns virtual memory on for subsequent LISP functions (defun)s
;* creates a user "COMMAND" that applies ALL specified CHANGE(S) to SELECTED TEXT strings
(defun C:CHGTXT (/ pr pr1 s h r x str ss) ; identifies all variables as "local"
(setq pr "Enter new ") ; pr = a partial prompt
(setq pr1 ", or hit a <CR> for no change... ") ; pr1 = a partial prompt
(setq S "" H "" R "" X "" str T ) ; initializes variables
(prompt "Select text entities to change... ")
(setq ss (sslength (ssget))) ; ssget selects entities in the data base
; ss = sslength, how many entities were selected?
(while (not (eq str "")) ; loops thru input of changes until <CR> only is hit
(prompt "\nChange Style/Height/Rotation/or teXt string? ")
(setq str (strcase (getstring "\nEnter S,H,R or X, or hit a <CR> to execute... ")))
; str = gets WHAT to change,
; strcase converts input to UPPERCASE for testing
(if (member str '("S" "H" "R" "X")) ; gets what to CHANGE IT TO if str tests as valid input
(cond ; s,h,r or x = gets CHANGE IT TO input in
; correct format to match str
; strcat combines partial prompts with "quoted key words"
((eq str "H") (setq h (getreal (strcat pr "Height" pr1)))
(if (numberp h) nil (setq h "")) ; tests h, makes it a nil string "" if
) ; <CR> or invalid input was entered
((eq str "S") (setq s (getstring (strcat pr "Style" pr1))))
((eq str "X") (setq x (getstring T (strcat pr "teXt string" pr1))))
((eq str "R") (setq r (getangle (strcat pr "Rotation angle" pr1)))
(if (numberp r) (setq r (strcat "<<" (angtos r 0 4))) (setq r ""))
) ; if tests r, makes it a nil string "" if <CR> or invalid input
; was entered; Otherwise strcat & angtos convert angle to
; universal format <<nnn.dddd string
) ) ) ; closes while, if & cond
(command "CHANGE" "P" "" "" "" S H R X) ; initiates CHANGE cmd & applies changes to first text entity
(while (not (eq (setq ss (1- ss)) 0)) (command "" S H R X))
; loop thru CHANGE cmd, count down ss until
; all selected entities are changed
) ; close defun
;* TRANSPARENT SNAP/GRID, call from menu w/...
; 'SETVAR SNAPUNIT (trsnpgr);\'SETVAR GRIDUNIT !V2 ^G^G
; uses new or restores prev saved value, independent of SNAPUNIT GRIDUNIT variables,
; has user resetable GRID ratio (multiplier)
(setq sgmult 10 sinc (car (getvar "snapunit"))) ; initializes
(defun trsnpgr ()
(prompt (strcat
"\nTo respec snap/grid Multiplier <" (rtos sgmult 2 2) "X>, preface SNAP value w/ - (eg: -.125)"))
(setq v (getreal (strcat
"\nEnter <->SNAP value or <CR> for <" (rtos sinc) ">... ")))
(if v ; tests for <CR> (nil)
(progn ; resets sinc & uses new
(if (minusp v)
(progn
(setq sgmult (getreal "Enter new Snap/Grid Multiplier... "))
(setq v (abs v))
)
) ; closes if
(setq v (list (setq sinc v) v)) ; value for SNAP
) ; closes progn
(setq v (list sinc sinc)) ; uses old value
) ; closes if
(setq v2 (list (* sgmult sinc) (* sgmult sinc))) ; variable for GRID
(setq v v) ; returns value of last expression for SNAP
) ; closes defun
;*For T1-188 Transparent SNAP
; call from menu w/... 'SETVAR SNAPUNIT (trsnap);
; uses new or restores prev saved value, independent of SNAPUNIT variable
(setq sinc (car (getvar "snapunit"))) ; initializes sinc
(defun trsnap ()
(if (setq v (getreal (strcat ; tests for <CR>
"\nEnter SNAP value or <CR> for <" (rtos sinc) ">... ")))
(setq v (list (setq sinc v) v)) ; resets sinc & uses new
(setq v (list sinc sinc)) ; uses old value
) ) ; closes if & defun
; Developed By B. Rustin Gesner, FOR WORKING OUT WITH AutoCAD By Martha Lubow
(defun Cdate ( /CD)
(setq CD (rtos (getvar "Cdate") 2 6))
(strcat (substr CD 5 2) "/" (substr CD 7 2) "/" (substr CD 3 2) " "
(substr CD 10 2) ":" (substr CD 12 2) ":" (substr CD 14 2)))